import request from '@/utils/request'
const moduleUrl = '/blog/articles'
export function createArticle(data) {
  return request({
    url: `${moduleUrl}/create`,
    method: 'post',
    data: data
  })
}

export function fetchList(query) {
  return request({
    url: `${moduleUrl}/all`,
    method: 'get',
    params: query
  })
}

export function fetchArticle(id) {
  return request({
    url: `${moduleUrl}/` + id,
    method: 'get'
  })
}

export function fetchPv(pv) {
  return request({
    url: '/vue-element-admin/article/pv',
    method: 'get',
    params: { pv }
  })
}


export function updateArticle(data) {
  return request({
    url: '/vue-element-admin/article/update',
    method: 'post',
    data
  })
}
